package com.net.xpay.partner.controller.partner;

import com.net.common.model.ResultPagedList;
import com.net.xpay.common.domain.partner.Partner;
import com.net.xpay.common.domain.partner.PartnerSettleLog;
import com.net.xpay.common.manager.partner.PartnerSettleLogManager;
import com.net.xpay.common.model.search.PartnerSettleLogSearchModel;
import com.net.xpay.partner.secutiry.RequestUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

/**
 *

 * 合伙人结算记录
 */
@RestController
@RequestMapping("/partner/partner-settle-log")
@Api(tags = "运营/合伙人结算记录", description = "运营 合伙人结算记录 net")
public class PartnerSettleLogController {

    @Autowired
    private PartnerSettleLogManager partnerSettleLogManager;

    @ApiOperation("搜索合伙人结算记录")
    @PostMapping("/search")
    @ResponseBody
    public ResultPagedList<PartnerSettleLog> searchPartnerSettleLog(@ApiIgnore @RequestUser Partner partner, @RequestBody PartnerSettleLogSearchModel searchModel) {
        searchModel.setPartnerId(partner.getId());
        List<PartnerSettleLog> records = partnerSettleLogManager.search(searchModel);
        long count = partnerSettleLogManager.searchCount(searchModel);
        return new ResultPagedList<>(records, count, searchModel);
    }
}
